using UniversalAdminSystem.Domian.Core.Interfaces;
using UniversalAdminSystem.Domian.FileStorage.ValueObjects;
using UniversalAdminSystem.Domian.knowledge.Aggregates;
using UniversalAdminSystem.Domian.knowledge.ValueObj;

namespace UniversalAdminSystem.Domian.knowledge.IRepository;

public interface IDocumentChunkRepository : IRepository<DocumentChunk>
{
    /// <summary>
    /// 数据库中匹配余弦值的前topK个相似文档
    /// </summary>
    /// <param name="queryEmbedding"></param>
    /// <param name="level"></param>
    /// <param name="topK"></param>
    /// <returns></returns>
    Task<IEnumerable<DocumentChunk>> FindSimilarDocumentsAsync(TextEmbedding queryEmbedding, FileAccessLevel level, int topK = 5);

    /// <summary>
    /// 批量文件id删除
    /// </summary>
    /// <param name="Id"></param>
    /// <returns></returns>
    Task BatchDeleteDocumentChunkAsync(Guid Id);

    /// <summary>
    /// 以id批量修改文本块等级
    /// </summary>
    /// <param name="FileId"></param>
    /// <param name="level"></param>
    /// <returns></returns>
    Task BatchModificationChunkLevelAsync(Guid FileId, FileAccessLevel level);

    /// <summary>
    /// 批量添加文本块
    /// </summary>
    /// <param name="chunks"></param>
    /// <returns></returns>
    Task BulkAddDocumentChunkAsync(IEnumerable<DocumentChunk> chunks);
    Task<bool> ExistsByFileIdAsync(Guid fileId);
}